Author Topic: problem, building C::B latest on freebsd 6.2  (Read 5348 times)

Offline theultramage

  • Multiple posting newcomer
  • *
  • Posts: 13
problem, building C::B latest on freebsd 6.2
« on: May 02, 2007, 01:40:35 pm »
Code
g++ -DHAVE_CONFIG_H -I. -I. -I../../../../src/include -I/usr/X11R6/lib/wx/include/gtk2-unicode-release-2.8 -I/usr/X11R6/include/wx-2.8 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -D__WXGTK__ -pthread -D_THREAD_SAFE -DXTHREADS -DXUSE_MTSAFE_API -I/usr/local/include/gtk-2.0 -I/usr/local/lib/gtk-2.0/include -I/usr/local/include/atk-1.0 -I/usr/local/include/cairo -I/usr/local/include/pango-1.0 -I/usr/local/include/glib-2.0 -I/usr/local/lib/glib-2.0/include -I/usr/X11R6/include -I/usr/local/include/freetype2 -I/usr/local/include -I../../../../src/include -I../../../../src/include/wxscintilla/include -I../../../../src/include/wxFlatNotebook/include -Ulinux -Uunix -O2 -ffast-math -g -O2 -DCB_PRECOMP -Winvalid-pch -fPIC -DPIC -fexceptions -MT memorymappedfile.lo -MD -MP -MF .deps/memorymappedfile.Tpo -c memorymappedfile.cpp  -fPIC -DPIC -o .libs/memorymappedfile.o

memorymappedfile.cpp: In static member function `static wxULongLong wxMemoryMappedFile::GetFileSize64(wxMemoryMappedFileHandleType)':
memorymappedfile.cpp:222: error: `off64_t' was not declared in this scope
memorymappedfile.cpp:222: error: expected `;' before "size"
memorymappedfile.cpp:223: error: `lseek64' was not declared in this scope
memorymappedfile.cpp:224: error: `size' was not declared in this scope
memorymappedfile.cpp:228: error: `size' was not declared in this scope
gmake[5]: *** [memorymappedfile.lo] Error 1
gmake[5]: Leaving directory `/usr/src/codeblocks/src/plugins/contrib/codesnippets'
Build machine is freebsd 6.2. I'm building C::B with wx2.8, since 2.6 is throwing wx errors when drawing some graphics. Or at least trying to - this module won't build. The reason is
probably because freebsd doesn't seem to have off64_t or the functions that use it.
I'll do gmake -i in the meantime.

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7591
    • My Best Post
Re: problem, building C::B latest on freebsd 6.2
« Reply #1 on: May 02, 2007, 11:37:54 pm »
Using Google, I may have found an solution, it needs tested on BSD and MAC OSX.
Note, BSD and Darwin are supposed to 64 bit already in lseek and other calls.
Tim S

Code
Index: src/plugins/contrib/codesnippets/memorymappedfile.cpp
===================================================================
--- src/plugins/contrib/codesnippets/memorymappedfile.cpp (revision 3917)
+++ src/plugins/contrib/codesnippets/memorymappedfile.cpp (working copy)
@@ -218,6 +218,14 @@
     {
         return wxULongLong(INVALID_FILE_SIZE);
     }
+#elif defined(__BSD__) || defined(__DARWIN__)
+    off_t size = lseek(hFile, 0, SEEK_END);
+    lseek(hFile, 0, SEEK_SET);//go back to the start of the file
+    if (-1 == size)
+    {
+        throw wxMemoryMappedInvalidFileSize();
+    }
+    return wxULongLong(size);   
 #else
     off64_t size = lseek64(hFile, 0, SEEK_END);
     lseek64(hFile, 0, SEEK_SET);//go back to the start of the file
« Last Edit: May 04, 2007, 03:23:14 am by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline theultramage

  • Multiple posting newcomer
  • *
  • Posts: 13
Re: problem, building C::B latest on freebsd 6.2
« Reply #2 on: May 04, 2007, 01:51:00 am »
Yeah, that one probably did the trick.
Now to deal with this new addition
Code
./wxslistbook.cpp: In member function `virtual bool wxsListbook::OnMouseClick(wxWindow*, int, int)':
/usr/X11R6/include/wx-2.8/wx/listbook.h:94: error: `virtual int wxListbook::HitTest(const wxPoint&, long int*) const' is protected
./wxslistbook.cpp:301: error: within this context
gmake[6]: *** [wxslistbook.lo] Error 1

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7591
    • My Best Post
Re: problem, building C::B latest on freebsd 6.2
« Reply #3 on: May 04, 2007, 03:06:26 am »
Yeah, that one probably did the trick.
Now to deal with this new addition
Code
./wxslistbook.cpp: In member function `virtual bool wxsListbook::OnMouseClick(wxWindow*, int, int)':
/usr/X11R6/include/wx-2.8/wx/listbook.h:94: error: `virtual int wxListbook::HitTest(const wxPoint&, long int*) const' is protected
./wxslistbook.cpp:301: error: within this context
gmake[6]: *** [wxslistbook.lo] Error 1

What 2.8 are you using; the above bug was supposed to be fixed in 2.8.3?

I am updated my old patch for the new wxSmith right below.

New patch below:
Code
Index: src/plugins/contrib/wxSmith/wxwidgets/defitems/wxslistbook.cpp
===================================================================
--- src/plugins/contrib/wxSmith/wxwidgets/defitems/wxslistbook.cpp (revision 3929)
+++ src/plugins/contrib/wxSmith/wxwidgets/defitems/wxslistbook.cpp (working copy)
@@ -297,7 +297,12 @@
 bool wxsListbook::OnMouseClick(wxWindow* Preview,int PosX,int PosY)
 {
     UpdateCurrentSelection();
+#if wxCHECK_VERSION(2, 8, 0) && (!(wxCHECK_VERSION(2, 8, 3)))
+    // Work around on bug in wxWidgets 2.8.0 to 2.8.2
+    wxBookCtrlBase* Listbook = (wxBookCtrlBase*)Preview;
+#else
     wxListbook* Listbook = (wxListbook*)Preview;
+#endif
     int Hit = Listbook->HitTest(wxPoint(PosX,PosY));
     if ( Hit != wxNOT_FOUND )
     {

Old Patch Below:

Code
Index: src/plugins/contrib/wxSmith/defwidgets/wxslistbook.cpp
===================================================================
--- src/plugins/contrib/wxSmith/defwidgets/wxslistbook.cpp (revision 3438)
+++ src/plugins/contrib/wxSmith/defwidgets/wxslistbook.cpp (working copy)
@@ -204,7 +204,11 @@
  if ( GetPreview() && event.LeftDown() )
  {
      wxListbook* Preview = (wxListbook*)GetPreview();
+#if wxCHECK_VERSION(2, 8, 0)
+        int Hit = wxStaticCast(Preview, wxBookCtrlBase)->HitTest(wxPoint(event.GetX(),event.GetY()));
+#else
      int Hit = Preview->HitTest(wxPoint(event.GetX(),event.GetY()));
+#endif
         if ( Hit != wxNOT_FOUND )
         {
             CurrentSelection = GetChild(Hit);

Tim S
« Last Edit: May 04, 2007, 04:03:15 am by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline theultramage

  • Multiple posting newcomer
  • *
  • Posts: 13
Re: problem, building C::B latest on freebsd 6.2
« Reply #4 on: May 04, 2007, 08:41:21 am »
Quote
What 2.8 are you using; the above bug was supposed to be fixed in 2.8.3?
The freebsd ports guys are at 2.8.0 at the moment. :\

EDIT: yeah your patch fixed the last compilation problem :)
« Last Edit: June 02, 2007, 03:46:53 pm by theultramage »

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7591
    • My Best Post
Re: problem, building C::B latest on freebsd 6.2
« Reply #5 on: May 04, 2007, 03:40:35 pm »
Quote
What 2.8 are you using; the above bug was supposed to be fixed in 2.8.3?
The freebsd ports guys are at 2.8.0 at the moment. :\

wxWidgets 2.8.0 should be OK, 2.8.1 and 2.8.2 were not very stable. I use stable to mean that the had a very short time a mater of days before patches were out for them or a new release was out.
Did my new patch above fix the issue?

Tim S

« Last Edit: May 04, 2007, 03:44:23 pm by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org